// +----------------------------------------------------------------------
// | Manong.Cloud [ 领酷码农云 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2020 http://www.manong.cloud All rights reserved.
// +----------------------------------------------------------------------
// | Author: 稻草人 <qinuoyun@qq.com>
// +----------------------------------------------------------------------
// | Member: 围棋 飘逸者 Loumt Silence24
// +----------------------------------------------------------------------
const OPEN_PREFIX = "https://open.weixin.qq.com/connect";


export default class WechatOpen {

	$config = {}

    constructor(config) {
        this.$config = Object.assign({}, config)
    }

    getCode(appid = '', redirect_uri = ''){

    	if (!appid && !redirect_uri) {
    		const {
                appid,
                redirect_uri
            } = this.$config
    	}

    	let url = `${OPEN_PREFIX}/qrconnect?appid=${appid}&redirect_uri=${encodeURI(redirect_uri)}&response_type=code&scope=snsapi_login#wechat_redirect`;

    	return url;

    }

}


